<?php
header("Content-type:text/html; charset=utf-8");
require_once ('config.php');
require_once (WEBURL.'/include/conn.php');
require_once (WEBURL.'/login_status_check.php');

if(!isset($_GET['channel_id'])){
	echo "forbidden!";
	exit();
}
if(!checkLogin()){
	$id=$_GET['channel_id'];
	$gotopage=base64_encode("channel_modify.php?channel_id=".$id);
	header("Location:admin_login.php?gotopage=".$gotopage);

}
else{
	require_once (WEBURL.'/channel.class.php');
	require_once (WEBURL.'/system.class.php');
	$_SESSION['allowed_select_model']="allowed";
	$smarty->assign("title","修改栏目信息");
	$channel=new Channel();
	$all_channel=$channel->getAllChannel("channel");
	$all_article_channel=$channel->getAllChannel("article");

	$smarty->assign("all_channel",$all_channel);
	$smarty->assign("all_article_channel",$all_article_channel);
	$channel_id=$_GET['channel_id'];
	$smarty->assign("channel_id",$channel_id);
	$channel_information_tmp=$channel->getChannelInformation($channel_id);
	if($channel_information_tmp==""){
		echo "不存在该id的栏目";
		exit();
	}
	$channel_information=explode("|",$channel_information_tmp);
	$smarty->assign("pre_id",$channel_information[0]);
	$smarty->assign("channel_name",$channel_information[1]);
	$smarty->assign("channel_describe",base64_decode($channel_information[3]));
	$smarty->assign("channel_model",$channel_information[4]);
	$smarty->assign("article_model",$channel_information[5]);
	$smarty->assign("pre_channel_grade",$channel_information[6]-1);
	$smarty->display("channel_modify.htm",md5("channel_modify.php?channel_id=".$channel_id));
}